/**
 * ...
 * >author		João Vítor de Souza
 */

package com.cupcakeengine.core 
{
	
	import com.cupcakeengine.display.GameObject;	
	import flash.display.DisplayObject;
	import flash.events.EventDispatcher;
	import flash.utils.Dictionary;
	import flash.utils.getDefinitionByName;

	public class ObjectManager extends EventDispatcher 
	{
		// ___________________________________________________________________ CONSTANTS
		
		// ___________________________________________________________________ CLASS PROPERTIES		
		
		// ___________________________________________________________________ INSTANCE PROPERTIES
		
		private static var _instance	: ObjectManager;
		
		// ___________________________________________________________________ GETTERS AND SETTERS
		
		// ___________________________________________________________________ CONSTRUCTOR
		
		public function ObjectManager (singleton:SingletonObligate) {}
		
		// ___________________________________________________________________ PUBLIC METHODS
		
		public static function getInstance () : ObjectManager
		{
			if (!ObjectManager._instance) ObjectManager._instance = new ObjectManager(new SingletonObligate());
			return ObjectManager(ObjectManager._instance);
		}
		
		public function getGameObject(display:DisplayObject, align:String = "TL", isTransparent:Boolean = false, bitmapDataObject:Object = null, bitmapObject:Object = null):GameObject
		{			
			return ObjectFactory.getInstance().getGameObject(display, align, isTransparent, bitmapDataObject, bitmapObject);
		}		
		
		public function getReusable(id:String):*
		{			
			return ReusablePool.getInstance().getReusable(id);			
		}
		
		public function addReusable(id:String, data:*):void
		{			
			ReusablePool.getInstance().add(id, data);
		}
		
		public function releaseReusable(id:String, data:*):void
		{
			ReusablePool.getInstance().release(id, data);
		}
		
		// ___________________________________________________________________ PRIVATE METHODS
		
		// ___________________________________________________________________ EVENTS
	}
}

class SingletonObligate {}
